package UDP2;

import java.io.*;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;

public class Send3 {
    public static void main(String[] args) throws IOException, InterruptedException {
        DatagramSocket socket = new DatagramSocket();
        Reader reader = new FileReader("day10-file_io/src/File8.txt");
        BufferedReader br = new BufferedReader(reader);
        String line;
        while((line=br.readLine())!=null){
             byte[] data = line.getBytes();
             socket.send(new DatagramPacket(data, data.length, InetAddress.getLocalHost(), 8080));
            try {
                Thread.sleep(2000);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

}
